#ifndef NETWORKTHREAD_H
#define NETWORKTHREAD_H

#include <QThread>

class NetworkThread : public QThread
{
    Q_OBJECT

public:
    explicit NetworkThread(QObject *parent = 0);
    ~NetworkThread();

    void stop(void);
    bool initNetwork(QString &name, QString &staticip, QString &staticnetmask, QString &staticgateway, QString &dns1, QString &dns2);
    bool isInitOK(void);

protected:
    void run(void);

private:
    bool networkDetect(QString &ifname);
    bool networkNewIP(QString &ifname, const char *ip, const char *netmask);
    bool networkNewGateWay(const char *gateway);

    bool loop;
    bool uiok;
    bool ipset;
    QString ifname[3];
    QString staticip;
    QString staticmask;
    QString staticgw;
    QString dns1;
    QString dns2;

signals:
    void Network2UI_UpdateStatusSignal(int status);

public slots:

private slots:
    void slot_SetUIIsOK(bool status);
};

#endif // NETWORKTHREAD_H
